const MongoClient = require('mongodb').MongoClient;
const express = require('express');
const app = express();

const url = 'mongodb://localhost:27017/amg';

app.get('/baby/love',function(req,res){
    MongoClient.connect(url,function(err,db){
        if(!err){
            const collection = db.collection('amg');
            collection.find({}).toArray(function(err,result){
                if(!err){
                    res.json(result);
                }
            })
        }
        db.close();
    })
})
app.listen(80);